import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router'
import { Nav } from 'app/classes/Device';
@Component({
  selector: 'app-content-tab',
  templateUrl: './content-tab.component.html',
  styleUrls: ['./content-tab.component.css']
})
export class ContentTabComponent implements OnInit {
  public navs: Array<Nav>;
  public status = 0;
  public type: string;
  constructor(
    public router: Router,
    public routerInfo: ActivatedRoute,

  ) {

  }

  ngOnInit() {
    const pathname = location.pathname
    if (pathname.indexOf('moniter') !== -1) {
      this.navs = [
        new Nav( '能耗查询', './', 'energy' ),
        new Nav( '曲线查询', 'data-query', 'dataQuery' ),
        new Nav( '谐波数据查询', 'harmonic-query', 'harmonicQuery' ),
        new Nav( '示值查询', 'indicate-query', 'indicateQuery' ),
        new Nav( '班组电量考核', 'banzu', 'banzu' ),
      ]
    }
    if (pathname.indexOf('event') !== -1) {
      this.navs = [
        new Nav( '事件查询', './', 'energy' ),
/*         new Nav( '事件参数设置', 'data-query', 'dataQuery' ),
        new Nav( '批量订阅', 'harmonic-query', 'harmonicQuery' ),
        new Nav( '事件订阅', 'indicate-query', 'indicateQuery' ),
        new Nav( '免扰设置', 'indicate-query', 'energy' ), */
      ]
    }
    if (pathname.indexOf('config') !== -1) {
      this.navs = [
        new Nav( '尖峰平谷设置', './', 'config' ),
        new Nav( '事件参数设置', 'data-query', 'dataQuery' ),
        new Nav( '班组设置', 'harmonic-query', 'harmonicQuery' ),
        new Nav( '设备管理', 'device-config', 'deviceConfig' ),
      ]
    }
    /*
        case 'event':
          this.navs = [
            {
              name: '事件查询', url: 'index/moniter', type: params['type']
            },
            {
              name: '事件参数设置', url: `index/moniter/${params['type']}/data-query`
            },
            {
              name: '批量订阅', url: `index/moniter/${params['type']}/harmonic-query`
            },
            {
              name: '事件订阅', url: `index/moniter/${params['type']}/indicate-query`
            },
            {
              name: '免扰设置', url: `index/moniter/${params['type']}/indicate-query`
            }
          ]; break;
        case 'count':
          this.navs = [
            {
              name: '报表分析', url: 'index/moniter', type: params['type']
            },
            {
              name: '耗能分析', url: `index/moniter/${params['type']}/data-query`
            },
            {
              name: '耗能类比', url: `index/moniter/${params['type']}/harmonic-query`
            }
          ]; break;
        case 'conserve':
          this.navs = [
            {
              name: '功率因素分析', url: 'index/moniter', type: params['type']
            },
            {
              name: '能耗成本', url: `index/moniter/${params['type']}/data-query`
            },
            {
              name: '需量分析', url: `index/moniter/${params['type']}/harmonic-query`
            },
            {
              name: '日负载率分析', url: `index/moniter/${params['type']}/indicate-query`
            },
            {
              name: '日不平衡度分析', url: `index/moniter/${params['type']}/indicate-query`
            },
            {
              name: '线损分析', url: `index/moniter/${params['type']}/indicate-query`
            }
          ]; break;
      }
    } ) */

  }
}
